//  Abstract:
//    OPF Object
//
//  Reference:
//    Open Packaging Format (OPF) 2.0 v0.9871.0
//    http://www.idpf.org/2007/opf/OPF_2.0_final_spec.html
//
//    Information and documentation - The Dublin Core metadata element set
//    ISO Standard 15836-2003
//    http://www.niso.org/international/SC4/n515.pdf
//
//    Guidelines for implementing Dublin Core in XML
//    http://dublincore.org/documents/dc-xml-guidelines/
//
//  Design Notes:
//    Provide abstraction of ZIP container as specified in OCF 1.0
//    Require support of libzip
//
//  Disclaimer:
//    Copyright (C) 2008, Janice Law <janicel700@gmail.com>.
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
//
#ifndef _EPUB_OPF
#define _EPUB_OPF

#include <gtkmm.h>
#include <boost/shared_ptr.hpp>
#include <boost/tuple/tuple.hpp>
#include <libxml++/libxml++.h>

using namespace std;
using namespace boost;
using Glib::ustring;
using Glib::RefPtr;

namespace Epub
{
class Opf
{
        friend class Ocf;
    public:
        typedef tuple<ustring> ustring_1_entry;
        typedef list<ustring_1_entry> ustring_1_list;
        typedef tuple<ustring, ustring> ustring_2_entry;
        typedef list<ustring_2_entry> ustring_2_list;
        typedef tuple<ustring, ustring, ustring> ustring_3_entry;
        typedef list<ustring_3_entry> ustring_3_list;

        Opf();
        ~Opf();

        // Accessor methods
        ustring_1_list get_title();
        void set_title(ustring_1_list param);
        ustring_1_list get_language();
        void set_language(ustring_1_list param);
        ustring_3_list get_identifier(); // content, id, scheme
        void set_identifier(ustring_3_list param);
        ustring_3_list get_creator(); // content, file-as, role
        void set_creator(ustring_3_list param);
        ustring_1_list get_subject();
        void set_subject(ustring_1_list param);
        ustring_1_list get_description();
        void set_description(ustring_1_list param);
        ustring_1_list get_publisher();
        void set_publisher(ustring_1_list param);
        ustring_3_list get_contributor(); // content, file-as, role
        void set_contributor(ustring_3_list param);
        ustring_2_list get_date(); // content, event
        void set_date(ustring_2_list param);
        ustring_1_list get_type();
        void set_type(ustring_1_list param);
        ustring_1_list get_format();
        void set_format(ustring_1_list param);
        ustring_1_list get_source();
        void set_source(ustring_1_list param);
        ustring_1_list get_relation();
        void set_relation(ustring_1_list param);
        ustring_1_list get_coverage();
        void set_coverage(ustring_1_list param);
        ustring_1_list get_rights();
        void set_rights(ustring_1_list param);
    protected:
        xmlpp::Node::PrefixNsMap nsMap;
        shared_ptr<xmlpp::Document> opf_xml;
        Opf(shared_ptr<xmlpp::Document> opf_document);
        void Refresh();
        ustring_1_list Query(ustring queryString);
        ustring_2_list Query(ustring queryString, ustring attrName1);
        ustring_3_list Query(ustring queryString, ustring attrName1,
                ustring attrName2);
        void Replace(ustring xpath, ustring node, ustring_1_list param);
        void Replace(ustring xpath, ustring node, ustring attrName1,
                ustring_2_list param);
        void Replace(ustring xpath, ustring node, ustring attrName1,
                ustring attrName2, ustring_3_list param);
};
} // Epub

#endif // _EPUB_OPF
